From: Jasper St. Pierre Date: Thu, 7 Feb 2013 08:27:55 +0000 (-0500) Subject: keyboard: Make sure to set currentSource if we only have one source X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~1013^2^2~4930 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=997f851031222eac76ce1cc468d57ae6be29b380;p=gnome-shell.git keyboard: Make sure to set currentSource if we only have one source This way, popping up and re-closing the switcher won't emit an error trying to check for this._currentSource. https://bugzilla.gnome.org/show_bug.cgi?id=693303 --- diff --git a/js/ui/status/keyboard.js b/js/ui/status/keyboard.js index 47c648f56..8295c1a65 100644 --- a/js/ui/status/keyboard.js +++ b/js/ui/status/keyboard.js @@ -410,6 +410,9 @@ const InputSourceIndicator = new Lang.Class({ let newSourceIndex = this._settings.get_uint(KEY_CURRENT_INPUT_SOURCE); let newSource = this._inputSources[newSourceIndex]; + let oldSource; + [oldSource, this._currentSource] = [this._currentSource, newSource]; + if (!newSource || (nVisibleSources < 2 && !newSource.properties)) { // This source index might be invalid if we weren't able // to build a menu item for it, so we hide ourselves since @@ -424,9 +427,6 @@ const InputSourceIndicator = new Lang.Class({ this.actor.show(); - let oldSource; - [oldSource, this._currentSource] = [this._currentSource, newSource]; - if (oldSource) { oldSource.menuItem.setShowDot(false); this._container.set_skip_paint(oldSource.indicatorLabel, true);